package com.gasolinator.a.intent;

import android.content.Context;
import android.content.Intent;
import com.google.inject.Inject;
import com.google.inject.Provider;

import java.io.Serializable;

public class ActivityStarter implements IActivityStarter
{
    @Inject
    protected static Provider<Context> contextProvider;
    private Intent intent;

    private Intent getIntent()
    {
        if (intent == null)
        {
            intent = new Intent();
        }
        return intent;
    }

    public void putExtra(String name, Serializable value)
    {
        getIntent().putExtra(name, value);
    }

    public void setClassName(String packageName, String className)
    {
        getIntent().setClassName(packageName, className);
    }

    public void startView()
    {
        contextProvider.get().startActivity(getIntent());
    }
}